/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modulos.usuario.vista;

import basedatos.OperacionesBD;
import java.util.ArrayList;
import modulos.usuario.modelo.Usuario;
import modulos.usuario.modelo.Permiso;

/**
 *
 * @author Edulima
 */
public class iFrmPermisos extends javax.swing.JInternalFrame {

    private Permiso permiso = null;
    private Usuario usuarioSelect = new Usuario();
    private Usuario usuario = new Usuario();
    private ArrayList<Usuario> listaUsuarios = new ArrayList<Usuario>();

    /**
     * Creates new form iFrmPermisos
     */
    public iFrmPermisos() {
        initComponents();
        listarUsuarios();
    }

    private void listarUsuarios() {
        listaUsuarios = (ArrayList<Usuario>) OperacionesBD.listar("Usuario");
        for (Usuario medico : listaUsuarios) {
            cmbUsuario.addItem(medico);
        }
    }

    private void setValores() {
        //Archivo
        cbxMedico.setSelected(permiso.isMedico());
        cbxAgendaPrivada.setSelected(permiso.isAgendaPrivada());
        cbxCompania.setSelected(permiso.isCompania());
        cbxCerrarSesion.setSelected(permiso.isCerrarSesion());

        //Servicios
        cbxAgendaPublica.setSelected(permiso.isAgendaPublica());
        cbxReservaciones.setSelected(permiso.isReservaciones());
        cbxSesionMedica.setSelected(permiso.isSesionMedica());
        cbxPaciente.setSelected(permiso.isPaciente());
        cbxListarPacientes.setSelected(permiso.isListarPacientes());
        cbxHistoriaClinica.setSelected(permiso.isHistoriaClinica());
        cbxCodigosDg.setSelected(permiso.isCodigosDg());
        cbxEnfermeMedica.setSelected(permiso.isEnfer_Medica());
        cbxMedicamento.setSelected(permiso.isMedicamentos());

        //Reportes
        cbxConsultas.setSelected(permiso.isConsultasRep());

        //Configuraciones
        cbxSeguridad.setSelected(permiso.isSeguridad());
        cbxDependencias.setSelected(permiso.isDependencias());
        cbxEntorno.setSelected(permiso.isEntorno());
        cbxAlarma.setSelected(permiso.isAlarmas());
        cbxReservacionConf.setSelected(permiso.isReservacionConf());
        cbxCertificadoMedico.setSelected(permiso.isCertiMedico());

        //Backup
        cbxRespaldo.setSelected(permiso.isRespaldo());
        cbxRespaldoConf.setSelected(permiso.isRespaldoConf());

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        cmbUsuario = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        cbxMedico = new javax.swing.JCheckBox();
        cbxAgendaPrivada = new javax.swing.JCheckBox();
        cbxCompania = new javax.swing.JCheckBox();
        cbxCerrarSesion = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        cbxAgendaPublica = new javax.swing.JCheckBox();
        cbxReservaciones = new javax.swing.JCheckBox();
        cbxSesionMedica = new javax.swing.JCheckBox();
        cbxPaciente = new javax.swing.JCheckBox();
        cbxCodigosDg = new javax.swing.JCheckBox();
        cbxEnfermeMedica = new javax.swing.JCheckBox();
        cbxMedicamento = new javax.swing.JCheckBox();
        cbxHistoriaClinica = new javax.swing.JCheckBox();
        cbxListarPacientes = new javax.swing.JCheckBox();
        jPanel5 = new javax.swing.JPanel();
        cbxSeguridad = new javax.swing.JCheckBox();
        cbxDependencias = new javax.swing.JCheckBox();
        cbxEntorno = new javax.swing.JCheckBox();
        cbxAlarma = new javax.swing.JCheckBox();
        cbxReservacionConf = new javax.swing.JCheckBox();
        cbxCertificadoMedico = new javax.swing.JCheckBox();
        jPanel6 = new javax.swing.JPanel();
        cbxRespaldo = new javax.swing.JCheckBox();
        cbxRespaldoConf = new javax.swing.JCheckBox();
        jPanel8 = new javax.swing.JPanel();
        cbxConsultas = new javax.swing.JCheckBox();
        btnCerrar = new javax.swing.JButton();
        txtTipoUsuario = new javax.swing.JLabel();

        setClosable(true);
        setTitle("PERMISOS DE USUARIO");

        jLabel1.setFont(new java.awt.Font("Ubuntu", 1, 14)); // NOI18N
        jLabel1.setText("Usuario:");

        cmbUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbUsuarioActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Ubuntu", 1, 14)); // NOI18N
        jLabel3.setText("Tipo de Cuenta:");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Seleccione el Permiso"));
        jPanel1.setLayout(null);

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Archivo", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 14), new java.awt.Color(3, 14, 147))); // NOI18N

        cbxMedico.setText("Medico");
        cbxMedico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxMedicoActionPerformed(evt);
            }
        });

        cbxAgendaPrivada.setText("Mis Contactos (Agenda Privada)");
        cbxAgendaPrivada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxAgendaPrivadaActionPerformed(evt);
            }
        });

        cbxCompania.setText("Compañia");
        cbxCompania.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxCompaniaActionPerformed(evt);
            }
        });

        cbxCerrarSesion.setText("Cerrar Sesion");
        cbxCerrarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxCerrarSesionActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbxMedico)
                    .addComponent(cbxAgendaPrivada)
                    .addComponent(cbxCompania)
                    .addComponent(cbxCerrarSesion))
                .addContainerGap(68, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(cbxMedico)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbxAgendaPrivada)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbxCompania)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(cbxCerrarSesion)
                .addContainerGap())
        );

        jPanel1.add(jPanel3);
        jPanel3.setBounds(10, 20, 320, 130);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Servicios", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 14), new java.awt.Color(6, 17, 147))); // NOI18N
        jPanel4.setLayout(null);

        cbxAgendaPublica.setText("Agenda Telefonica(Publica)");
        cbxAgendaPublica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxAgendaPublicaActionPerformed(evt);
            }
        });
        jPanel4.add(cbxAgendaPublica);
        cbxAgendaPublica.setBounds(18, 19, 196, 22);

        cbxReservaciones.setText("Reservaciones");
        cbxReservaciones.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxReservacionesActionPerformed(evt);
            }
        });
        jPanel4.add(cbxReservaciones);
        cbxReservaciones.setBounds(18, 47, 116, 22);

        cbxSesionMedica.setText("Sesion Medica");
        cbxSesionMedica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxSesionMedicaActionPerformed(evt);
            }
        });
        jPanel4.add(cbxSesionMedica);
        cbxSesionMedica.setBounds(18, 75, 116, 22);

        cbxPaciente.setText("Paciente (Crear Ficha)");
        cbxPaciente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxPacienteActionPerformed(evt);
            }
        });
        jPanel4.add(cbxPaciente);
        cbxPaciente.setBounds(18, 103, 165, 22);

        cbxCodigosDg.setText("Codigos Dg");
        cbxCodigosDg.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxCodigosDgActionPerformed(evt);
            }
        });
        jPanel4.add(cbxCodigosDg);
        cbxCodigosDg.setBounds(18, 187, 97, 22);

        cbxEnfermeMedica.setText("Enfermedades y Medicamentos");
        cbxEnfermeMedica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxEnfermeMedicaActionPerformed(evt);
            }
        });
        jPanel4.add(cbxEnfermeMedica);
        cbxEnfermeMedica.setBounds(18, 215, 240, 22);

        cbxMedicamento.setText("Medicamentos");
        cbxMedicamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxMedicamentoActionPerformed(evt);
            }
        });
        jPanel4.add(cbxMedicamento);
        cbxMedicamento.setBounds(18, 243, 118, 22);

        cbxHistoriaClinica.setText("Historia Clinica");
        cbxHistoriaClinica.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxHistoriaClinicaActionPerformed(evt);
            }
        });
        jPanel4.add(cbxHistoriaClinica);
        cbxHistoriaClinica.setBounds(18, 159, 118, 22);

        cbxListarPacientes.setText("Listar Pacientes");
        cbxListarPacientes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxListarPacientesActionPerformed(evt);
            }
        });
        jPanel4.add(cbxListarPacientes);
        cbxListarPacientes.setBounds(18, 131, 125, 22);

        jPanel1.add(jPanel4);
        jPanel4.setBounds(10, 150, 320, 270);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Configuraciones", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 14), new java.awt.Color(3, 14, 147))); // NOI18N

        cbxSeguridad.setText("Seguridad");
        cbxSeguridad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxSeguridadActionPerformed(evt);
            }
        });

        cbxDependencias.setText("Dependencias");
        cbxDependencias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxDependenciasActionPerformed(evt);
            }
        });

        cbxEntorno.setText("Entorno");
        cbxEntorno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxEntornoActionPerformed(evt);
            }
        });

        cbxAlarma.setText("Alarmas");
        cbxAlarma.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxAlarmaActionPerformed(evt);
            }
        });

        cbxReservacionConf.setText("Reservaciones");
        cbxReservacionConf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxReservacionConfActionPerformed(evt);
            }
        });

        cbxCertificadoMedico.setText("Certificado Medico");
        cbxCertificadoMedico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxCertificadoMedicoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbxSeguridad)
                    .addComponent(cbxDependencias)
                    .addComponent(cbxEntorno)
                    .addComponent(cbxAlarma)
                    .addComponent(cbxReservacionConf)
                    .addComponent(cbxCertificadoMedico))
                .addContainerGap(115, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(cbxSeguridad)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbxDependencias)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbxEntorno)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbxAlarma)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbxReservacionConf)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cbxCertificadoMedico)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.add(jPanel5);
        jPanel5.setBounds(340, 20, 280, 190);

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Backup", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 14), new java.awt.Color(3, 14, 147))); // NOI18N

        cbxRespaldo.setText("Respaldo");
        cbxRespaldo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxRespaldoActionPerformed(evt);
            }
        });

        cbxRespaldoConf.setText("Restaurar Respaldo");
        cbxRespaldoConf.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxRespaldoConfActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(cbxRespaldo)
                    .addComponent(cbxRespaldoConf))
                .addContainerGap(109, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(cbxRespaldo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(cbxRespaldoConf)
                .addContainerGap())
        );

        jPanel1.add(jPanel6);
        jPanel6.setBounds(340, 210, 281, 80);

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Reportes", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Ubuntu", 1, 14), new java.awt.Color(3, 14, 147))); // NOI18N

        cbxConsultas.setText("Consultas");
        cbxConsultas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxConsultasActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cbxConsultas)
                .addContainerGap(169, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cbxConsultas)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1.add(jPanel8);
        jPanel8.setBounds(340, 290, 280, 70);

        btnCerrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/jpgs/agt_home.png"))); // NOI18N
        btnCerrar.setText("Cerrar");
        btnCerrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrarActionPerformed(evt);
            }
        });

        txtTipoUsuario.setFont(new java.awt.Font("Ubuntu", 1, 14)); // NOI18N
        txtTipoUsuario.setText("USUARIO");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addGap(18, 18, 18)
                                .addComponent(cmbUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtTipoUsuario, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel2)
                                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 634, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addGap(8, 8, 8))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(btnCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(cmbUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(txtTipoUsuario))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addGap(8, 8, 8)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 448, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnCerrar)
                .addContainerGap(18, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void cbxRespaldoConfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxRespaldoConfActionPerformed
        permiso.setRespaldoConf(cbxRespaldoConf.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxRespaldoConfActionPerformed

    private void cbxMedicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxMedicoActionPerformed
        permiso.setMedico(cbxMedico.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxMedicoActionPerformed

    private void cbxAgendaPrivadaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxAgendaPrivadaActionPerformed
        permiso.setAgendaPrivada(cbxAgendaPrivada.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxAgendaPrivadaActionPerformed

    private void cbxCompaniaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxCompaniaActionPerformed
        permiso.setCompania(cbxCompania.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxCompaniaActionPerformed

    private void cbxCerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxCerrarSesionActionPerformed
        permiso.setCerrarSesion(cbxCerrarSesion.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxCerrarSesionActionPerformed

    private void cbxAgendaPublicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxAgendaPublicaActionPerformed
        permiso.setAgendaPublica(cbxAgendaPublica.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxAgendaPublicaActionPerformed

    private void cbxReservacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxReservacionesActionPerformed
        permiso.setReservaciones(cbxReservaciones.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxReservacionesActionPerformed

    private void cbxSesionMedicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxSesionMedicaActionPerformed
        permiso.setSesionMedica(cbxSesionMedica.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxSesionMedicaActionPerformed

    private void cbxPacienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxPacienteActionPerformed
        permiso.setPaciente(cbxPaciente.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxPacienteActionPerformed

    private void cbxListarPacientesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxListarPacientesActionPerformed
        permiso.setListarPacientes(cbxListarPacientes.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxListarPacientesActionPerformed

    private void cbxHistoriaClinicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxHistoriaClinicaActionPerformed
        permiso.setHistoriaClinica(cbxHistoriaClinica.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxHistoriaClinicaActionPerformed

    private void cbxCodigosDgActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxCodigosDgActionPerformed
        permiso.setCodigosDg(cbxCodigosDg.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxCodigosDgActionPerformed

    private void cbxEnfermeMedicaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxEnfermeMedicaActionPerformed
        permiso.setEnfer_Medica(cbxEnfermeMedica.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxEnfermeMedicaActionPerformed

    private void cbxMedicamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxMedicamentoActionPerformed
        permiso.setMedicamentos(cbxMedicamento.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxMedicamentoActionPerformed

    private void cbxConsultasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxConsultasActionPerformed
        permiso.setConsultasRep(cbxConsultas.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxConsultasActionPerformed

    private void cbxSeguridadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxSeguridadActionPerformed
        permiso.setSeguridad(cbxSeguridad.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxSeguridadActionPerformed

    private void cbxDependenciasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxDependenciasActionPerformed
        permiso.setDependencias(cbxDependencias.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxDependenciasActionPerformed

    private void cbxEntornoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxEntornoActionPerformed
        permiso.setEntorno(cbxEntorno.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxEntornoActionPerformed

    private void cbxAlarmaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxAlarmaActionPerformed
        permiso.setAlarmas(cbxAlarma.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxAlarmaActionPerformed

    private void cbxReservacionConfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxReservacionConfActionPerformed
        permiso.setReservacionConf(cbxReservacionConf.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxReservacionConfActionPerformed

    private void cbxCertificadoMedicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxCertificadoMedicoActionPerformed
        permiso.setCertiMedico(cbxCertificadoMedico.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxCertificadoMedicoActionPerformed

    private void cbxRespaldoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxRespaldoActionPerformed
        permiso.setRespaldo(cbxRespaldo.isSelected());
        OperacionesBD.modificar(permiso);
    }//GEN-LAST:event_cbxRespaldoActionPerformed

    private void cmbUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbUsuarioActionPerformed
        int index = cmbUsuario.getSelectedIndex();
        if (index != -1) {
            usuarioSelect = listaUsuarios.get(index);
            permiso = (Permiso) OperacionesBD.buscar("Permiso", "usuario_idPersona", usuarioSelect.getIdPersona() + "");
            txtTipoUsuario.setText(usuarioSelect.getCuentaUsr().getTipo());
            if (permiso != null) {
                setValores();
            }
        }
    }//GEN-LAST:event_cmbUsuarioActionPerformed

    private void btnCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarActionPerformed
        dispose();
    }//GEN-LAST:event_btnCerrarActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCerrar;
    private javax.swing.JCheckBox cbxAgendaPrivada;
    private javax.swing.JCheckBox cbxAgendaPublica;
    private javax.swing.JCheckBox cbxAlarma;
    private javax.swing.JCheckBox cbxCerrarSesion;
    private javax.swing.JCheckBox cbxCertificadoMedico;
    private javax.swing.JCheckBox cbxCodigosDg;
    private javax.swing.JCheckBox cbxCompania;
    private javax.swing.JCheckBox cbxConsultas;
    private javax.swing.JCheckBox cbxDependencias;
    private javax.swing.JCheckBox cbxEnfermeMedica;
    private javax.swing.JCheckBox cbxEntorno;
    private javax.swing.JCheckBox cbxHistoriaClinica;
    private javax.swing.JCheckBox cbxListarPacientes;
    private javax.swing.JCheckBox cbxMedicamento;
    private javax.swing.JCheckBox cbxMedico;
    private javax.swing.JCheckBox cbxPaciente;
    private javax.swing.JCheckBox cbxReservacionConf;
    private javax.swing.JCheckBox cbxReservaciones;
    private javax.swing.JCheckBox cbxRespaldo;
    private javax.swing.JCheckBox cbxRespaldoConf;
    private javax.swing.JCheckBox cbxSeguridad;
    private javax.swing.JCheckBox cbxSesionMedica;
    private javax.swing.JComboBox cmbUsuario;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JLabel txtTipoUsuario;
    // End of variables declaration//GEN-END:variables
}
